
import {createRouter, createWebHashHistory,createMemoryHistory,createWebHistory} from "vue-router"


let  routes = [
    
    {
        path:'/',
        component:()=>import("../pages/home/index.vue"),
        name:'/',
        meta:{
            name:"首页"
        },
        children:[
            {
                path:"discover",
                component:()=>import("../pages/discover/index.vue"),
                redirect:"/discover/playlist",
                name:"discover", //具名路由
                // meta 属性 内容可以随意更改
                meta:{
                    name:"发现"
                },
                children:[
                    {
                        path:"playlist",
                        component:()=>import("../pages/discover/playlist/index.vue"),
                        name:"playlist",
                        meta:{
                            name:"歌单"
                        }
                    },
                    
                ]
            },
            {   
                props:true, //路由解耦合
                path:"friend/:id",
                component:()=>import("../pages/friend/index.vue"),
                name:"friend",
                meta:{
                    name:"朋友"
                }
            },
            {
                path:"mine",
                component:()=>import("../pages/mine/index.vue"),
                name:"mine",
                meta:{
                    name:"个人中心"
                }
            }
        ]
    },
    {
        path:"/login",
        component:()=>import("../pages/login/index.vue"),
        name:"login",
        meta:{
            name:"登入"
        }
    }
    
]


const router = createRouter({
    history:createWebHashHistory(),
    routes
})


export default router